1. Field of the Invention
The present invention relates to a duplex system using a main memory database, and particularly, to a method and apparatus for database synchronization in the duplex system.
2. Background of the Related Art
Systems which are required to process, in real-time, a large amount of data stored on an online network, such as an intelligent network supplying an intelligent information service, a home location register (HLR) in a mobile communication system, and a computer system in a bank, are adopting the duplex storage system to process data smoothly and to prevent an overload. The stored data is constructed as a database structure in order to real-time process the large amount of data promptly and the database is stored in the main memory.
When a duplex database system is used, database synchronization between the duplex database systems should be maintained synchronization both when the systems operate properly and after a fault has occurred in one system, once the faulty system is restored. FIG. 1 is a block diagram showing a structure of an apparatus for database synchronization in a related art duplex system. Two independent database systems, that is, a local system (primary system) 10 and a remote system (secondary system) 20, form the duplex system. Both of the independent systems have the same structure because they are constructed as duplex systems. A description of the local system 10 will now be provided that applies equally well to the remote system. The local system 10 includes a database 11, a Database Management System (DBMS) 12, an Application Process (AP) 13, a Database (DB) initialization library 14, an update queue 15, a transmission process 16, a receive process 17, and an arbiter 18.
The database 11 stores the data processed online by the local system 10, the DBMS 12 manages the database 11, and the application process 13 performs query operations to the database 11. The DB initialization library 14 deletes all data stored in database 21 of the remote system 20 when the remote system 20 is rerun, due to a fault occurring in the remote system 20. The update queue 15 stores updated data when components of the database are updated. Transmission process 16 transmits a database deletion message to the remote system 20, under the control of the DB initialization library 14, and transmits data stored in the update queue 15 to the remote system 20. Receive process 17 receives the messages transmitted from the remote system 20 and transmits then to the application process 13. When data stored in the update queue 15 fails to be reflected in the remote system 20, the arbiter 18 records the data in a file.
The operation of the related art duplex database synchronization system is described in relation to its normal operation and to when a synchronization fault occurs.
(A) Normal Operation
When a transaction query process occurs within the local system 10 requiring database synchronization between the duplex systems, application process 13 accesses the database 11 through DBMS 12 and processes the query. Then, the AP 13 stores the transaction information in the update queue 15 so that the transaction information may be reflected to the database of the remote system 20.
Transmission process 16 checks the update queue 15 periodically and, if there is an update transaction in update queue 15, the transmission process 16 transmits the transaction to receive process 27 of the remote system 20. Receive process 27 of the remote system 20 transmits the transaction information to AP 23, which stores the information to database 21 of the remote system 20. After that, if the AP 23 stores the update transaction successfully, transmission process 26 informs receive process 17, of the local system 10, of its success.
When the transaction update of database 21 is successfully reflected in remote system 20, the transaction information is deleted from the update queue 15 of the local system 10. However, if the transaction update to database 21 fails to be successfully reflected in the remote system, arbiter 18 of the local system 10 generates a log file corresponding to the transaction which failed the synchronization. The log file is processed when the system is restarted.
(B) Synchronization Fault
If a fault occurs in a database system, then the system experiencing the fault is restored by copying the entire contents of the operational system to the faulty system. For example, if a fault is generated in the local system 10, the local system 10 is reinitialized using the operational database of the remote system 20, after the fault is repaired. To accomplished this, the reinitialized local system 10 informs the remote system of the reinitialization and then the DB initialization library 24 of the remote system 20 orders the deletion of all data stored in database 11 of the local system 10. The local system 10 deletes all data stored in database 11, in accordance with the database initialization order. Remote system 20 copies the data stored in its database 21 to database 11 of the local system 10, once it learns that database 11 of the local system 10 is reinitialized.
During the copying process, messages that are processed by the remote system concurrently with the copying process are stored in update queue 25. After the copying process to the local system 10 is finished, the remote system 20 transmits the data stored in the update queue 25 to the local system 10 and database synchronization between the remote system 20 and the local system 10 is performed for the messages transferred from update queue 25.
Therefore, when a fault occurring in one system is restored, the data stored in its database is entirely deleted. Thereafter, the data stored in the other system is copied to the restored system. Additionally, database transactions occurring in the operational database during the database copying operation are later reflected to the restored database by the update queue.
As described above, the related art apparatus for database synchronization has the problem that the database synchronization process is complex. When a fault is generated is one system of the duplex systems, the faulty system is reinitialized and data stored in the database of the normal system are copied to the database of the reinitialized system, after all the data stored in the faulty database are deleted. Because a large amount of data must be transferred from one database to the other when a fault occurs, a large processing load is placed on the duplex system.
Additionally, when the updated contents of one database are stored in the update queue for reflection to the other system, while the entire content of a database is being copied, the disk approaching time and data transmission time is long. Therefore, the performance of the main memory database may be lowered.
Also, in the event the reflection of the updated data to the other system fails, the failed operation is stored as a log file and the log file is processed when the system is restarted, later. This, too, reduces the operational speed, due to the time required to generate the file input/output and because the file may be damaged.